home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / HackAddict™ Magazine / HA 1-12 / HackAddict08.sit / HackAddict 8 ƒ / HackAddict™ 8.rsrc / TEXT_136.txt < prev    next >
Text File  |  1997-11-30  |  8KB  |  227 lines

  1.          Random Access
  2.  
  3.  
  4.      This stuff is totally unsupported. These are various excerpts from posts, text files, other magazines, etc. that I have found in my travels. I have tried to at least give the author credit, but the magazine or text file it originally appeared in is not always easy to find out. (These are unedited for the most part so my apologies for lack of spellng, grammar, etc)
  5.  
  6.  
  7.  
  8.  
  9.  
  10. Creating users on a Hotline server from an application:
  11.  
  12.      In the absense of any Application Programming Interface for Hotline that doesn't use the dreaded AppleScript, programming third party utilities can be very difficult. In the development of a recent utility for my server I found the need for a function that created new users from membership requests in the news. The prospective member posts a request in the news in the form of,
  13.  
  14.         USER:NewHotlineMember
  15.         PASS:MyPassword
  16.  
  17.      Each week the new users are created by running the application which parses the Hotline Server 'News' file for membership requests.
  18.     
  19.      At the moment, this code extract (which does the job of creating the new user) is fairly primitive. Essentially, it takes two parameters. These describe the id number and the type of a resource in which an appropriate 734 bytes of 'UserData' (as found in a UserData's Data Fork) can be found. Firstly, the code could be easily modified to create a new user in any server application on the machine. All this would really involve would be to edit the call to CreatorTypeFileSearch() to return an array of FSSpecs rather than only one. Also, special file areas for the new members can be added by simply creating an alias to the new files section and placing it in their folder.
  20.  
  21.     To use the code, various extra functions are needed. Firstly, pstrcpy() is needed. If you don't have it, write it. All the function does is to copy the pascal string in the second parameter to the address in the first. Most importantly, Apple's developer package MoreFiles version 1.4.5 (or better) is needed. The package is freely available from Apple Devworld, you should be able to find it by searching on any of the Apple Developer web or ftp sites.
  22.  
  23. ¬∞Agam -X-
  24. ------------------------------------------------------------------------------------
  25.  
  26. #include <Gestalt.h>
  27. #include <Files.h>
  28. #include <Resources.h>
  29. #include <Errors.h>
  30. #include <MoreFilesExtras.h>
  31. #include <Search.h>
  32. #include <FSpCompat.h>
  33.  
  34. void AddHotlineUser(ResType resType,short resID);
  35. /*---------------------------------------------------
  36. ResType:                         Type of resource the userdata is held in
  37. resID:                            ID of resource the userdata is held in
  38. -----------------------------------------------------*/
  39.  
  40. void AddHotlineUser(ResType resType, short resID)
  41. {
  42. SysEnvRec info;
  43. FSSpec userdir;
  44. long count,theDirID,size;
  45. Boolean isDirectory;
  46. short vRefNum,refNum;
  47. Handle datahdl;
  48. OSType creator = 'HTLS';
  49. OSType type     = 'APPL';
  50. OSType userdataType  = 'HTud';
  51. Str255 login;
  52.  
  53. SysEnvirons(1, &info);
  54. vRefNum = info.sysVRefNum;    // Get vRefNum of main disk.
  55.  
  56. datahdl = GetResource(resType,resID); // Get data from rsrc
  57. pstrcpy(login,(*datahdl)+665); // copy the pstring at 665 to login.
  58.  
  59. if (CreatorTypeFileSearch(nil,vRefNum,creator,type,&userdir,1,&count,true)==noErr)
  60.     {
  61.     // Found HL server application
  62.     // Select 'User' folder
  63.     if (FSMakeFSSpec(vRefNum,userdir.parID,"\pUsers",&userdir)==noErr);
  64.     // Get it's DirectoryID
  65.     if (FSpGetDirectoryID(&userdir,&theDirID,&isDirectory)==noErr);
  66.     // Specify a new folder called login
  67.     if (FSMakeFSSpec(vRefNum,theDirID,login,&userdir)==fnfErr);
  68.     // Create it.
  69.     if (FSpDirCreateCompat(&userdir,0,&theDirID)==noErr);
  70.     // Specify a file in folder called 'UserData'
  71.     if (FSMakeFSSpec(vRefNum,theDirID,"\pUserData",&userdir)==fnfErr);
  72.     // Create the new file
  73.     if (FSpCreateCompat(&userdir,creator,userdataType,1)==noErr);
  74.     if (FSpOpenDF(&userdir,dmRdWrDenyRdWr,&refNum)==noErr);
  75.     // Open it
  76.     {
  77.     size = GetResourceSizeOnDisk(datahdl); // How big is the data
  78.     FSWriteNoCache(refNum,&size,*datahdl); // Write data to open file
  79.     FSClose(refNum); // Close File
  80.     }
  81.     }
  82. } // end Add Hotline User
  83.  
  84. - ¬∞Agam -X-
  85.  
  86.  
  87.  
  88.  
  89. More on the UNIX History File: 
  90.  
  91.     An extention to the information in the last issue of HackAddict
  92. regarding the history file in UNIX. Create a file called ".bash_profile"
  93. using a text editor. I recomend the following line: "pico .bash_profile" because I like pico. Type "unset HISTFILE" and save the file. This will eliminate the ".bash_history" file from your account forever.
  94.  
  95. - Phreakout
  96.  
  97.  
  98.  
  99.  
  100. Cracking Hotline UserData Files
  101.  
  102.      You will need a datafork editor or my application: HLUserDataEditor (included)
  103.  
  104.      Most of the information stored in the UserData files is easily read. The account name and login are visible at offsets (in decimal) 530 and 666 respectively. However, the password and the account privileges are somewhat encoded. The account password starts at offset 702 and is encoded. The encoding algorithm is like this:
  105.  
  106. For the example we will use the password ‚Äúaaa‚Äù
  107. The ascii code for the letter ‚Äúa‚Äù is 97
  108. so then you would do this:
  109.  
  110. 255-97=158
  111.  
  112. and 158 is the acsii code for √ª
  113. and that is what will show up in the UserData file.
  114.  
  115.      Now the account privileges are a little harder. They are stored between offset 4 and 8. Each privilege has an ascii number at a one of the 4 offsets (or columns). At the end of this article are two charts that will help explain this. Example:
  116.  
  117.      If the user was allowed to download, upload, and get user info then the UserData file would look like this:
  118.  
  119. hex-{60 00 00 80}
  120. ascii-{`  √Ñ}
  121.  
  122.   If you look at my chart you will see that the privledge "Can Download Files" adds a 32 to the first column, Can Upload a 64 to the first column, and "Can Get User Info" a 128 to the fourth column. When Hotline puts the privs in a file it adds up everything in one column and then writes the ascii character for that number to the file. Knowing this you will see that the ascii character for 32+64 is ` and for 128 √Ñ. If you are smart you can figure out a way to take the ascii number for the character in the file and figure out which privs have been selected for that user by using only the chart, your brain, and a datafork editor. If you aren‚Äôt that smart or just lazy, use my application.
  123.  
  124.  
  125.  
  126. UserData Priv Charts by ¬∞Catalyst‚àÜ
  127.  
  128. 1
  129. {32}{0}{0}{0}
  130. 2
  131. {64}{0}{0}{0}
  132. 3
  133. {0}{0}{0}{64}
  134. 4
  135. {128}{0}{0}{0}
  136. 5
  137. {16}{0}{0}{0}
  138. 6
  139. {8}{0}{0}{0}
  140. 7
  141. {0}{0}{0}{8}
  142. 8
  143. {4}{0}{0}{0}
  144. 9
  145. {2}{0}{0}{0}
  146. 10
  147. {1}{0}{0}{0}
  148. 11
  149. {0}{128}{0}{0}
  150. 12
  151. {0}{0}{0}{4}
  152. 13
  153. {0}{0}{0}{2}
  154. 14
  155. {0}{0}{0}{1}
  156. 15
  157. {0}{2}{0}{0}
  158. 16
  159. {0}{1}{0}{0}
  160. 17
  161. {0}{0}{128}{0}
  162. 18
  163. {0}{0}{64}{0}
  164. 19
  165. {0}{0}{0}{128}
  166. 20
  167. {0}{0}{2}{0}
  168. 21
  169. {0}{0}{1}{0}
  170. 22
  171. {0}{0}{8}{0}
  172. 23
  173. {0}{0}{4}{0}
  174. 24
  175. {0}{64}{0}{0}
  176. 25
  177. {0}{32}{0}{0}
  178. 26
  179. {0}{0}{0}{32}
  180. 27
  181. {0}{0}{0}{16}
  182.  
  183.  
  184. File System Maintenance
  185. 1,32    Can Download Files
  186. 1,64    Can Upload Files
  187. 4,64    Can Upload Anywhere
  188. 1,128    Can Delete Files
  189. 1,16    Can Rename Files
  190. 1,8    Can Move Files
  191. 4,8    Can Comment Files
  192. 1,4    Can Create Folders
  193. 1,2    Can Delete Folders
  194. 1,1    Can Rename Folders
  195. 2,128    Can Move Folders
  196. 4,4    Can Comment Folders
  197. 4,2    Can View Drop Boxes
  198. 4,1    Can Make Aliases
  199. User Maintenance
  200. 2,2    Can Create Users
  201. 2,1    Can Delete Users
  202. 3,128    Can Read Users
  203. 3,64    Can Modify Users
  204. 4,128    Can Get User Info
  205. 3,2    Can Disconnect Users
  206. 3,1    Cannot be Disconnected
  207. 3,8    Can Read News
  208. 3,4    Can Post News
  209. 2,64    Can Read Chat
  210. 2,32    Can Send Chat
  211. Miscellaneous
  212. 4,32    Can Use Any Name
  213. 4,16    Don't Show Agreement
  214.  
  215.  
  216. - ¬∞Catalyst
  217.  
  218.  
  219.  
  220.  
  221. Another Method of Defeating MacControl
  222.  
  223.      If you hold down the control+apple keys and double click on any of the system folders they stay open instead of closing right away.
  224.  
  225. - Crack Head
  226.  
  227.